|
1
|
|
|
/** |
|
2
|
|
|
* RS extensions to PlaceReference |
|
3
|
|
|
*/ |
|
4
|
|
|
module.exports = function(GedcomX){ |
|
5
|
|
|
|
|
6
|
|
|
// Extend serialization properties |
|
7
|
|
|
GedcomX.PlaceReference.jsonProps.push('normalized'); |
|
8
|
|
|
|
|
9
|
|
|
// Override init() so that we can deserialize normalized values |
|
10
|
|
|
var oldInit = GedcomX.PlaceReference.prototype.init; |
|
11
|
|
|
GedcomX.PlaceReference.prototype.init = function(json){ |
|
12
|
|
|
oldInit.call(this, json); |
|
13
|
|
|
if(json){ |
|
14
|
|
|
this.setNormalized(json.normalized); |
|
15
|
|
|
} |
|
16
|
|
|
}; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Set the normalized values |
|
20
|
|
|
* |
|
21
|
|
|
* @function setNormalized |
|
22
|
|
|
* @instance |
|
23
|
|
|
* @memberof PlaceReference |
|
24
|
|
|
* @param {TextValue[]} normalized |
|
25
|
|
|
* @return {PlaceReference} this |
|
26
|
|
|
*/ |
|
27
|
|
|
GedcomX.PlaceReference.prototype.setNormalized = function(normalized){ |
|
28
|
|
|
return this._setArray(normalized, 'normalized', 'addNormalized'); |
|
29
|
|
|
}; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Add a normalized value |
|
33
|
|
|
* |
|
34
|
|
|
* @function addNormalized |
|
35
|
|
|
* @instance |
|
36
|
|
|
* @memberof PlaceReference |
|
37
|
|
|
* @param {TextValue} normalized |
|
38
|
|
|
* @return {PlaceReference} this |
|
39
|
|
|
*/ |
|
40
|
|
|
GedcomX.PlaceReference.prototype.addNormalized = function(normalized){ |
|
41
|
|
|
return this._arrayPush(normalized, 'normalized', GedcomX.TextValue); |
|
42
|
|
|
}; |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Get the normalized values |
|
46
|
|
|
* |
|
47
|
|
|
* @function getNormalized |
|
48
|
|
|
* @instance |
|
49
|
|
|
* @memberof PlaceReference |
|
50
|
|
|
* @return {TextValue[]} |
|
51
|
|
|
*/ |
|
52
|
|
|
GedcomX.PlaceReference.prototype.getNormalized = function(){ |
|
53
|
|
|
return this.normalized || []; |
|
54
|
|
|
}; |
|
55
|
|
|
|
|
56
|
|
|
}; |